<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>智慧运营管理中心</title>
		{css href="__ADMIN__/css/login.css" /}
	</head>
	<body>
		<div id="particles-js" style="display: flex;align-items: center;justify-content: center">
			<canvas class="particles-js-canvas-el" style="width: 100%; height: 100%;" width="472" height="625"></canvas>
		</div>
		<div class="apTitle">大数据智慧运营管理平台</div>
		<div class="logcon">
			<!-- <form>
				<input type="text" name="username" placeholder="账号">
				<input type="password" name="password" placeholder="密码">
				<button id="submit" type="button">登录</button>
			</form>	 -->
			<form class="layui-form">
				<input type="text" name="username" required  lay-verify="username" placeholder="请输入账号" autocomplete="off" class="layui-input">
				<input type="password" name="password" required  lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
				<button class="layui-btn" lay-submit lay-filter="login">登录</button>
			</form>	
		</div>
		

		<!-- scripts -->
		{js href="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.2.1/jquery.min.js" /}
		{js href="__LAYUI__/layui.js" /}
		{js href="__ADMIN__/js/login.js" /}
		{js href="__ADMIN__/js/loginApp.js" /}
		<script>
			layui.use(['layer', 'form'], function () {
				var layer = layui.layer;
				var form = layui.form;

				// 表单验证规则
				form.verify({
					username: function (value) {
						if (value.length < 5) {
							return '用户名至少5个字符';
						}
					}
				});
				form.on('submit(login)', function (data) {
					console.log(data.field);
					$.ajax({
						method: "POST",
						url: "{:url('login/auth')}",
						data: data.field,
						success: function (res) {
							console.log(res);
							if (res.code == 200) {
								// 登录成功
								layer.confirm(res.msg, {
									btn: ['进入后台']
								}, function () {
									window.location.href="../admin";
								})
							} else {
								layer.alert(res.msg);
							}
						}
					});
					return false;
				});

				// $('button').click(function(){
				// 	let formdata = $('form').serializeArray();
					
				// });

				// layer.msg("12");
			});
			// $(function(){
			// 	$('button').click(function(){
			// 		let formdata = $('form').serializeArray();

					

			// 		// $.each(v, function () {
			// 		// 	console.log(this.value);
			// 		// });
			// 	});
			// });
		</script>

	</body>
</html>